#include <stdio.h>
#include <stdlib.h>

#include "heap.h"

int cmp(void* a, void* b) 
{
	int ia, ib;
	ia = *((int*) a);
	ib = *((int*) b);

	return ia-ib;
}

int print(void* a) 
{
	printf("%d", *((int*) a));
}

int main(int argc, char** argv) 
{
	int vec[] = {1, 3, 4, 3, -3, 5, 30, 54, 0, 3, 21, 9, 43, 76, 43, 12, 30, 80, 90, 3, 221, 32};
	int v[] = {1, 3, 3, -5, 9, 7};
	int i;
	void* topo;
	Heap* h = criarHeap(cmp);

	for (i=0; i<6; i++)
		adicionarElemento(h, &v[i]);

	for (i=0; i<6; i++) {
		topo = retornaTopo(h);
		printHeap(h, print);
		printf("\n");
		tirarElemento (h);
	}

	printf("\n");

	destruirHeap (h);

	return 0;
}
